package com.lightdz.tshirtdz.general;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

//import javax.servlet.MultipartConfigElement;

/**
 * @ Description：获取自定义环境变量的方法
 * @ Author     ：zbl
 * @ Date       ：Created in 16:21 27/06/2018
 * @ Modified By：
 */
@Configuration
@PropertySource("classpath:apiConfig.properties")
public class ApiConfig {

    @Value("${CommonReidsTime}")
    private int commonReidsTime; //公用缓存时间， 单位：分钟 默认30天（30*24*60）

    public int getCommonReidsTime() {
        return commonReidsTime > 0 ? commonReidsTime : 30 * 24 * 60;
    }

    @Value("${imgUploadDir}")
    private String imgUploadDir;

    public String getImgUploadDir() {
        return imgUploadDir;
    }

//    @Bean
//    public ServletWebServerFactory servletContainer() {
//        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
//        tomcat.addConnectorCustomizers(new GwsTomcatConnectionCustomizer());
//        return tomcat;
//    }
//
}
